<template>
    <tableLayout
    :columns="columns"
    :operationShow="true"
    :get="getData"
    ref="layout">

        <template #button>
          <!-- <a-button type="primary" style="margin-left: 20px" >彩蛋</a-button> -->
        </template>

        <template #operationMore="item">
          <a @click="StartWorkFlow(item.value.record)">启动</a>
          <a-divider type="vertical" />
        </template>
      
    </tableLayout>
</template>

<script lang="ts" setup>
import tableLayout from '@/components/tableLayout/tableLayout.vue';
import { getData,startWorkFlowInstance } from '@/api/flowdeploy';
import { notification,message } from 'ant-design-vue';
import { v4 as uuidv4 } from 'uuid';
//列表
const columns=[
    { title: '序号', dataIndex: 'Id' },
    { title: '名称', dataIndex: 'Name' }
]

const StartWorkFlow=(val:any)=>{
  startWorkFlowInstance([{
    ProcessDefinitionId:val.Id,
    BusinessKey:uuidv4(),
  }]).then(e =>{
    message.success("流程启动成功！");
  }).catch(err =>{
    message.error(err.message || "流程启动失败!");
  });
}
</script>